fix(proxy): clear expired retry cooldown transitions - #1908
Conversation
A persisted retry-circuit row with an elapsed (or absent) cooldown currently reloads its deadline as a non-zero monotonic timestamp in the past. The admission check interprets that state as a cooldown that just ended, consumes the exclusive half-open lease, and suppresses subsequent requests for the lease duration even though no cooldown remains. Normalize non-positive remaining durable cooldowns to the zero sentinel while preserving future deadlines. Add a regression proving elapsed rows do not burn a lease; thresholds, backoff, persistence, and ownership behavior remain unchanged.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe retry circuit now restores elapsed or absent durable cooldowns as an open state with no cooldown or half-open lease. Equal-version reloads clear stale local deadlines. Specifications and unit tests document and verify the behavior. ChangesRetry cooldown normalization
Estimated code review effort: 2 (Simple) | ~15 minutes Merge Risk: ⚪ Minimal · up to This localized change clears expired retry cooldown state while preserving newer failures and persisted state; the supplied checks pass, and no actionable merge-blocking risk remains beyond normal review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Follow-up on the expiry-transition review: commit ed8ee12 also clears a stale half-open lease when an equal-or-newer expired durable snapshot arrives after a transient lookup failure. Added regression coverage for future row -> lookup failure/lease -> same-version expired row. The branch is based directly on beta.4 main b311aea; no #1867 dependency. Affected gates pass: 37 retry-circuit tests, Ruff, format, ty, architecture, diff check, and strict scoped OpenSpec. |
|
Thanks — the underlying bug here is real and your regression tests demonstrate it well: an elapsed durable cooldown reloading as
|
|
Closing this branch unmerged because #1962 supersedes its accepted scope on current main. #1962 keeps the cooldown normalization and exact owner-bound half-open probe release, preserves the #1394 single-flight behavior, adds cancellation-safe teardown and OpenSpec coverage, and deliberately drops this PRs rejected equal/newer lease clearing. Exact successor head: eadaf45. Its local and independent reviews are complete and CodeRabbit has no current actionable threads. Hosted CI and Simplicity approval plus human maintainer review remain pending, so this is a supersession statement, not a merge-ready or deployment claim. No container mutation was performed. |
|
Correction to the supersession record: #1962 has since advanced from |
|
Correction to the supersession record: #1962 has advanced to exact current head |
|
Final correction to the supersession record: #1962 now points to exact current-main head |
|
Final supersession record correction: #1962 is now at exact current-main head |
Problem
An absent or elapsed durable retry cooldown was converted into
now_monotonic + 0. Admission interpreted that value as a real expiry transition and could create a half-open lease when no active cooldown existed.Why this PR exists
#1908 identified the arithmetic bug while the broader retry and stale-anchor work was being split. The root problem is real, but this branch also clears active half-open leases on equal or newer expired snapshots. That breaks the one-probe single-flight behavior introduced for #1394.
How this PR solves it
OpenSpec:
openspec/changes/normalize-expired-retry-cooldown/Scope
This branch changes retry-circuit normalization only. It does not own cooldown-suppressed session retirement from #1947, poisoned-anchor quarantine from #1891, or broad stale-anchor recovery from #1867.
Verification
Exact candidate:
ed8ee1222999bf6b58164529af3ae5724e09c4ecty, proxy architecture, strict targeted OpenSpec, andgit diff --checkpassed on the historical candidate.Current status
Do not merge this branch. The zero-sentinel normalization is being rebuilt on current upstream main in a focused successor that preserves the active owner lease, admits exactly one probe after genuine expiry, and settles only the matching owner and token. #1908 will be superseded and closed after that successor passes exact-head local and hosted review.